package com.voltmao.persistent.mapper;

import org.apache.ibatis.annotations.Param;
import com.voltmao.persistent.model.IntentUserAssign;
import com.voltmao.persistent.model.IntentUserAssignCriteria;

import java.util.List;
import java.util.Map;

public interface IntentUserAssignMapper {
    int countByExample(IntentUserAssignCriteria example);

    int deleteByExample(IntentUserAssignCriteria example);

    int deleteByPrimaryKey(String dataId);

    int insert(IntentUserAssign record);

    int insertSelective(IntentUserAssign record);

    List<IntentUserAssign> selectByExample(IntentUserAssignCriteria example);

    IntentUserAssign selectByPrimaryKey(String dataId);

    int updateByExampleSelective(@Param("record") IntentUserAssign record, @Param("example") IntentUserAssignCriteria example);

    int updateByExample(@Param("record") IntentUserAssign record, @Param("example") IntentUserAssignCriteria example);

    int updateByPrimaryKeySelective(IntentUserAssign record);

    int updateByPrimaryKey(IntentUserAssign record);

    IntentUserAssign selectByExampleForOne(IntentUserAssignCriteria example);

    Map<String, Object> selectMapByPrimaryKey(String dataId);

    Map<String, Object> selectMapByExampleForOne(IntentUserAssignCriteria example);

    List<Map<String, Object>> selectMapByExample(IntentUserAssignCriteria example);

    /**
     * 分配意向渠道给业务员
     * @param intentIdArr
     * @param emplFrom
     * @param emplTo
     * @param des
     * @return
     */
    int assignIntentToEmpl(@Param("intentIdArr") List<String> intentIdArr, @Param("emplFrom") String emplFrom, @Param("emplTo") String emplTo, @Param("des") String des);

    int deleteAssign(@Param("intentIdArr") List<String> intentIdArr);
    /**
     * 重新分配意向渠道
     * @param intentIdArr
     * @param emplTo
     * @param des
     * @return
     */
    int reAssignIntent(@Param("intentIdArr") List<String> intentIdArr, @Param("emplTo") String emplTo, @Param("des") String des);

    /**
     * 业务员获取自己负责的意向渠道列表
     * @param params
     * @return
     */
    List<Map<String, Object>> intentForEmpl(Map<String, Object> params);
    int countIntentForEmpl(Map<String, Object> params);

    /**
     * 总监获取所有意向渠道跟进信息
     * @param params
     * @return
     */
    List<Map<String, Object>> getIntentFollowInfo(Map<String, Object> params);
    int countIntentFollowInfo(Map<String, Object> params);

    /**
     * 总监获取正式渠道列表信息
     * @param params
     * @return
     */
    List<Map<String, Object>> getRealProviderFollowInfo(Map<String, Object> params);
    int countRealProviderFollowInfo(Map<String, Object> params);

    /**
     * 业务员获取自己跟进中的渠道数量和未跟进的渠道数量
     * @param emplId
     * @return
     */
    int getIntentNum(@Param("emplId") String emplId, @Param("hasFollow") String hasFollow);

    /**
     * 根据渠道id获跟进的业务员id
     * @param providerUserId
     * @return
     */
    String getEmplByProviderUserId(@Param("providerUserId") String providerUserId);

    /**
     * 业务获取可制作合同的渠道列表
     * @param params
     * @return
     */
    List<Map<String, Object>> intentForEmplContractSelect(Map<String, Object> params);
    int countIntentForEmplContractSelect(Map<String, Object> params);
}